/*
 * @Date: 2024-01-11 10:53:54
 * @LastEditors: lyx
 * @LastEditTime: 2024-01-11 14:29:02
 * @FilePath: \chlor-alkali-cloud-mobile-end\src\pages\integral\appeal\record\hooks\useAppealRecord.tsx
 * @Description:
 */
import React, { useEffect, useState } from "react";
import { useSetState } from "ahooks";
import { getRandomString, goToPage } from "@/utils/common";

function useAppealRecord() {
  const [dataSourcePageState, setDataSourcePageState] =
    useSetState<IDataSourcePagingState>({
      pageNum: 1,
      pageSize: 10,
      total: 0,
      dataSourceList: [],
      selectDataKeys: [],
    });

  const getDataList = () => {
    const cList: any = [];
    for (let i = 0; i < 10; i++) {
      cList.push({
        key: i,
        status: i % 3,
        serialNumber: getRandomString(16),
        integral: i,
        date: i,
      });
    }
    setDataSourcePageState({
      pageNum: 1,
      pageSize: 20,
      total: 20,
      dataSourceList: cList,
    });
  };

  const toDetail = (record: any) => {
    goToPage("pages/integral/appeal/detail/index");
  };

  useEffect(() => {
    console.log("请求数据");
    getDataList();
  }, []);

  return {
    dataSourcePageState,
    toDetail,
  };
}

export default useAppealRecord;
